package com.lc;

import java.io.File;

import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;

public class Db {   
	
	public void fxt(){
		
		
		Environment myDbEnvironment = null;
		Database myDatabase = null;
		try {
			//设置数据库环境,开启一个环境变量
		    EnvironmentConfig envConfig = new EnvironmentConfig();
		    //设置是否开启未创建数据库的目录,TRUE为允许
		    envConfig.setAllowCreate(true);
		/**这里的"/export/dbEnv"就是指定的数据库开发环境的目录*/ 
		    //记得要关系释放资源
		    myDbEnvironment = new Environment(new File("/export/dbEnv"), envConfig);
		    DatabaseConfig dbConfig = new DatabaseConfig();
		    dbConfig.setAllowCreate(true);
		    //开启一个Database需要一个DatabaseConfig配置信息支持
		    //记得要释放数据库资源Database.close()
		    myDatabase = myDbEnvironment.openDatabase(null,"sampleDatabase",dbConfig); 
		} catch (DatabaseException dbe) {
		    // Exception handling goes here
		}
		
		
	}

}
